package fei.yuzhi.com.loveflowers.fragment.classifyFragment;

import java.util.ArrayList;
import java.util.List;

import fei.yuzhi.com.loveflowers.bean.ClassifyAllBean;
import fei.yuzhi.com.loveflowers.bean.ClassifyItemBean;

import fei.yuzhi.com.loveflowers.utils.HttpUtils;



/**
 * Created by Administrator on 2016/10/5.
 */
public class ClassifyModle implements ClassifyContract.ClassifyModle {


    @Override
    public void getClassifyAllBean(final loadClassifyAllBean mclassifyAllBean) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                HttpUtils.getMapFromNet(new HttpUtils.onGetMapFromNet() {
                    @Override
                    public void getNetList(List<ClassifyAllBean.DatasBean> list) {
                        mclassifyAllBean.sendClassifyAllBean(list);
                    }
                });
            }
        }).start();

    }

    @Override
    public void getClassifyItemBean(final int id, final loadClassifyItemBean classifyItemBean) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                HttpUtils.getClassifyItemData(id,new HttpUtils.onGetClassifyItem() {
                    @Override
                    public void getNetClassifyList(List<ClassifyItemBean.DatasBean.ClassListBean.ChildBean> list) {
                        classifyItemBean.sendClassifyItemBean(list);
                    }
                });
            }
        }).start();

    }

    @Override
    public void getClassify(loadClassify mloadClassify) {
        List<String> list=new ArrayList<>();
        list.add("所有品牌");
        list.add("美妆个护");
        list.add("环球美食");
        list.add("营养保健");
        list.add("母婴专区");
        list.add("家居生活");
        list.add("儿童专区");
        list.add("特色专区");
        mloadClassify.sentClassify(list);

    }

    public interface loadClassifyAllBean{
        public void sendClassifyAllBean(List<ClassifyAllBean.DatasBean> list);
    }
    public interface loadClassify{
        public void sentClassify(List<String> list);
    }
    public interface loadClassifyItemBean{
        public void sendClassifyItemBean(List<ClassifyItemBean.DatasBean.ClassListBean.ChildBean> list);
    }
}
